package org.ns.learn.rpc.codec;

public class RpcResponse {
    private String requestId;
    private Object result;
    private ParameterType parameterType;
    private String error;


    public RpcResponse() {
    }

    public RpcResponse(String requestId) {
        this.requestId = requestId;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public ParameterType getParameterType() {
        return parameterType;
    }

    public void setParameterType(ParameterType parameterType) {
        this.parameterType = parameterType;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public void throwException() {
        if (getError() != null) {
            throw new RpcResponseException(error);
        }
    }
}
